var goodsViewCtrl = new XFApp.client();
XFApp.client.prototype.goodsView = {
	event : function(){
		
	},
	initViewByGoods : function(){
		var goods_status = "";
		$("#add_btn").attr("href",basePath+"/userCenter/goods/goodsRecord/viewAdd?itemNo="+sku_goods.itemno);
		for(index in stats_goodsStatus){
			var goodsStatus = stats_goodsStatus[index];
			if(goodsStatus.dictCode == sku_goods.docketstatus ){
				goods_status = goodsStatus.dictName;
			}
		}
		$("#docketstatus").text(goods_status);
		var apply_status = "";
		for(index in stats_approves){
			var approves = stats_approves[index];
			if(approves.dictCode == sku_goods.applystatus){
				apply_status = approves.dictName;
			}
		}
		$("#applystatus_des").text(apply_status);
	
		
		var currency_des = "";
		for(index in currencys){
			var currency = currencys[index];
			if(currency.dictCode == sku_goods.currency){
				currency_des = currency.dictName;
			}
		}
		$("#currency").text(currency_des);
		if(sku_goods.hasCell == 0){
			$("#hasCell").text("不含电池");
		}else{
			$("#hasCell").text("含电池");
		}
		
		var unit_des = "";
		var unit_des1 = "";
		var unit_des2 = "";
		for(index in units){
			var unit = units[index];
			if(unit.dictCode == sku_goods.unit){
				unit_des = unit.dictName;
			}
			if(unit.dictCode == sku_goods.unit1){
				unit_des1 = unit.dictName;
			}
			if(unit.dictCode == sku_goods.unit2){
				unit_des2 = unit.dictName;
			}
		}
		$("#unit").text(unit_des);
		$("#unit1").text(unit_des1);
		$("#unit2").text(unit_des2);
		
		var customer_des = "";
		for(index in customerCodes){
			var customer = customerCodes[index];
			if(customer.dictCode == sku_goods.customscode){
				customer_des = customer.dictName;
			}
		}
		$("#customSelect").text(customer_des);
		
		$("span").each(function(){
			var val = "";
			if(!!sku_goods[$(this).attr("name")]){
				val = sku_goods[$(this).attr("name")];
			}
			if($(this).hasClass("dataTime") && !!val){
				val = val.replace("T"," ");
			}
			if(!!val){
				$(this).text(val);
			}
		});
		
	}
}

$(function(){
	goodsViewCtrl.goodsView.event();
	if(!!sku_goods){
		goodsViewCtrl.goodsView.initViewByGoods();
	}
});